<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Quill 编辑器示例</title>
  <link rel="stylesheet" href="https://cdn.quilljs.com/1.3.7/quill.snow.css">
</head>
<body>
<div id="editor"></div>

<script src="https://cdn.quilljs.com/1.3.7/quill.min.js"></script>

<script>
  const quill = new Quill('#editor', {
    theme: 'snow'
  });

  quill.on('selection-change', (range, oldRange, source) => {
    if (source === 'user') {
      // 复制文本
      const selectedText = quill.getSelection().text;

      // 将光标移动到复制文本的最后一个字符之后
      quill.setSelection(selectedText.length, selectedText.length);
    }
  });

</script>
</body>
</html>
